The present invention relates to color gradients in a computer graphics application.
In many computer systems, information is represented and conveyed to a user through digital images. The digital images can take many different forms such as alphanumeric characters, graphs and a variety of pictorial representations. The digital images are typically conveyed to a user on a display device, such as a video monitor, or through a printing device, such as a color printer and the like. Typically, the digital images are stored in digital form, manipulated and then displayed to the user.
A digital image can be a geometric description of a two or three-dimensional scene. The geometric description can be manipulated by the user and converted to digital raster image data or vector data for display. How a two or three dimensional object appears when the object is displayed to the user depends on numerous factors including the types of light sources illuminating the object, properties of the object such as color, texture and reflectance, and the object's position and orientation with respect to the light sources, the viewer and other surfaces that may reflect light on the object.
It is often desirable to present objects for display in color. In conventional systems, color may be applied to a region by defining a single color for the entire region (a “flat” coloring), or to add realism, a plurality of colors may be employed. In order to display a realistic image, a smooth transition between colors across painted areas is required. Such a transition is referred to as a color gradient.
Color gradients can be generated in several ways. One way is to select a starting color, an ending color and, optionally, one or more intermediate colors on a gradient ramp. A representation of the gradient can be displayed to a user in a gradient bounding box during the creation of the gradient, so that the user can view the appearance of the gradient before applying the gradient to one or more objects. A linear gradient defines a color change along a line. A radial gradient defines a color change along the radius of a circle, so that concentric circles of constant color are obtained.
In addition to selecting the colors of the gradient, a user can conventionally select a number of attributes of the gradient. Examples of such attributes include angle, horizontal and vertical offset, and edge padding. The angle attribute is associated with a linear gradient and typically defines the gradient's angle to an imaginary horizontal axis on the display screen. The horizontal and vertical offset attributes are associated with a radial gradient and typically define the distance between a center point of a radial gradient and the center of the gradient bounding box. The edge padding attribute defines how long starting and ending colors remain constant along the edge of a gradient before blending with other colors.
Although the gradient attributes allow a user to further refine the visual appearance of a given gradient, the attributes have conventionally only been applied to the entire gradient, that is, to the entire object to which the gradient is to be applied. For example, a linear color gradient can traverse N colors between the starting and ending colors and can have an angle attribute, as described above. However, in conventional systems the gradient follows the selected angle through all the N colors. Similarly, if a radial gradient traverses N colors between the starting and ending colors, circles of constant color will be centered at the same point.
Furthermore, a gradient is generally generated in a gradient bounding box of a given size. When the gradient is applied to an object, the gradient is scaled up or down to fit the object dimensions. If a gradient is applied to a number of objects having different dimensions, the gradient appearance will vary between the objects unless a unique gradient is generated for each object.